StupidBeauty
Read times:387Posted at:Mon Jan 16 20:07:21 2012
- no title specified

转载:Download file error, Mime Type undefined

Wt3.2.0中的WStreamResource类存在一個回归(regression)问题,导致下载文件时會出错。Wt开发者已表示将尽快发布3.2.1版本。

http://redmine.webtoolkit.eu/boards/2/topics/3397

亮点:

Version: Wt 3.2.0

I'm Attempting to download a pdf file, that is being generated on the fly. The .pdf is created fine. I can manually goto the server find the .pdf that was created and open it. Everything seems good.

The problem is when the website attemps to send the .pdf to the user.

//write the pdf to disk

std::ofstream f(newFileName.c_str(), std::ios::out | std::ios::binary);

pdfImage.write(f);

//create resource to hold the pdf

WFileResource *fileResource = new Wt::WFileResource("application/pdf", newFileName);

fileResource->setDispositionType(Wt::WResource::Attachment);

fileResource->suggestFileName(newFileName);

WApplication::redirect(fileResource->url());

Client: Ubuntu Chrome 16.0.912.63; I get the Keep/Discard prompt. Click Keep. Transfer always halts on 5.8k out of XXXXX.

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands